package chpt03;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class PersonOverride {
	private String name;
	private int age;
	private boolean gender;
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public boolean isGender() {
		return gender;
	}

	public void setGender(boolean gender) {
		this.gender = gender;
	}

	public PersonOverride(String name, int age, boolean gender) {
		this.name = name;
		this.age = age;
		this.gender = gender;
	}

	public PersonOverride() {
		this("default", 1, true);
	}

	public String toString() {
		return String.format("%s-%s-%s", name,age,gender);

	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PersonOverride other = (PersonOverride) obj;
		if (age != other.age)
			return false;
		if (gender != other.gender)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}

}

public class Person_Cover {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int n1 = in.nextInt();
			PersonOverride[] person1 = new PersonOverride[n1];
			int n2 = in.nextInt();
			for (int i = 0; i < n1; i++) {
				person1[i] = new PersonOverride();
				System.out.println(person1[i]);
			}
			ArrayList<PersonOverride> person2 = new ArrayList<PersonOverride>(n2);
			int count = 0;
			for (int i = 0; i < n2; i++) {
				PersonOverride person = new PersonOverride(in.next(), in.nextInt(), in.nextBoolean());
				if (!person2.contains(person)) {
					person2.add(person);
					count++;
				}
			}
			for (PersonOverride p : person2) {
				System.out.println(p);
			}
			System.out.println(count);
			System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
		}
		in.close();
	}
}
